<?php

namespace common\entities\outstock;

use Yii;

/**
 * This is the model class for table "myscrm_delivery_sub_order".
 *
 * @property string $sub_order_id
 * @property string $delivery_guid
 * @property string $erp_contract_id
 * @property string $erp_contract_code
 * @property integer $flow_status
 * @property integer $sub_order_index
 * @property string $created_on
 * @property string $sub_order_code
 */
class MyscrmDeliverySubOrderEntity extends \common\entities\ContractEntity
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'myscrm_delivery_sub_order';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('contractDB');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['sub_order_id', 'delivery_guid', 'sub_order_code'], 'required'],
            [['flow_status', 'sub_order_index'], 'integer'],
            [['created_on'], 'safe'],
            [['sub_order_id', 'delivery_guid'], 'string', 'max' => 36],
            [['erp_contract_id', 'erp_contract_code', 'sub_order_code'], 'string', 'max' => 50]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'sub_order_id' => '待办guid',
            'delivery_guid' => '出库单guid',
            'erp_contract_id' => 'erp传过来的合同guid',
            'erp_contract_code' => 'erp传过来的合同号',
            'flow_status' => '流程状态30 已确认 , 40-已开通，50-已授权',
            'sub_order_index' => '待办序号',
            'created_on' => '创建时间',
            'sub_order_code' => '待办code',
        ];
    }
}
